/**
 * Copyright (c) 2018 人人开源 All rights reserved.
 *
 * https://www.renren.io
 *
 * 版权所有，侵权必究！
 */

package com.lswms.controller.admin;

import com.lswms.common.page.PageInfo;
import com.lswms.common.page.PageRequest;
import com.lswms.common.utils.Result;
import com.lswms.common.validator.ValidatorUtils;
import com.lswms.entity.YnUserEntity;
import com.lswms.service.YnUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户接口
 */
@RestController
@RequestMapping("/api/admin/user")
@Api(tags="用户接口-admin")
@Slf4j
public class AdminYnUserController {
    
    @Autowired
    private YnUserService ynUserService;

    @GetMapping("list")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "sTime",value = "起始时间 ： yyyy-MM-dd HH:mm:ss",dataType = "String",paramType = "query",required = true,example = "2020-06-11 00:00:00")
            ,@ApiImplicitParam(name = "eTime",value = "结束时间 ： yyyy-MM-dd HH:mm:ss",dataType = "String",paramType = "query",required = true,example = "2020-06-11 23:59:59")
    })
    @ApiOperation("条件查询用户列表")
    public Result<PageInfo<YnUserEntity>> userList(PageRequest dto, String sTime, String eTime){
        ValidatorUtils.validateEntity(dto);
        return new Result<PageInfo<YnUserEntity>>().ok(ynUserService.queryByCondition(dto,sTime,eTime));
    }


}